﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using NHibernate;
using NHibernate.Criterion;
using System.Web.UI.WebControls;
using NHibernate.Linq;
using mscook.core.domain;


namespace mscook.core.repositories
{
    public class SocialUserRelationRepository : Repository<SocialUserRelation>, ISocialUserRelationRepository
    {

        public SocialUserRelation SelectSocialUserRelationByPersonID(string personId)
        {
            var q = (from x in this.Session.Query<SocialUserRelation>() select x).Where(o => o.IsDelete == false && o.PersonID == personId).SingleOrDefault();
            return q;
        }

        public SocialUserRelation SelectSocialUserRelationByPersonName(string personName)
        {
            var query = (from x in this.Session.Query<SocialUserRelation>()
                         where x.IsDelete == false
                         && x.LoginName.Equals(personName)


                         select x);
            return query.SingleOrDefault();
        }

    }
}
